﻿@page
@{ Layout = "_Layout"; }

<el-row :gutter="0">
    <el-col :span="6">
        @await Html.PartialAsync("_PartialTree")
    </el-col>
    <el-col :span="18">
        <el-card shadow="never" style="border-start-start-radius:0;border-end-start-radius:0;">
            <el-form :inline="true" :size="euiSize">
                <el-form-item label="课程">
                    <el-input v-model="formInline.keyword" placeholder="名称，标签 关键字" prefix-icon="el-icon-search" clearable></el-input>
                </el-form-item>
                <el-form-item label="">
                    <el-select v-model="formInline.type" placeholder="" v-on:change="btnSearchClick" clearable style="width:158px;">
                        <el-option label="类型" value=""></el-option>
                        <el-option label="线上课" value="online"></el-option>
                        <el-option label="线下课" value="offline"></el-option>
                        <el-option label="公共课" value="public"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button icon="el-icon-search" type="primary" v-on:click="btnSearchClick">查 询</el-button>
                    <el-button plain icon="el-icon-plus" type="success" v-on:click="btnAddClick(true)">新增线上课</el-button>
                    <el-button plain icon="el-icon-plus" type="warning" v-on:click="btnAddClick(false)">新增线下课</el-button>
                </el-form-item>
            </el-form>
            <el-table ref="table" :data="list" :size="euiSize"
                      style="width: 100%" :height="$(window).height()-153">
                <el-table-column label="#"
                                 type="index"
                                 width="60"
                                 align="left">
                    <template scope="scope">
                        <span>{{(formInline.pageIndex - 1) * formInline.pageSize + scope.$index + 1}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="课程名称" show-overflow-tooltip prop="name">
                </el-table-column>
                <el-table-column label="课时" width="85" prop="studyHour">
                </el-table-column>
                <el-table-column label="学分" prop="credit" width="85">
                </el-table-column>
                <el-table-column label="类型" width="85">
                    <template slot-scope="scope">
                        <span v-if="scope.row.public"><el-tag size="mini" type="primary" effect="dark">公共课</el-tag></span>
                        <span v-else>
                            <span v-if="scope.row.offLine"><el-tag size="mini" type="warning" effect="dark">线下课</el-tag></span>
                            <span v-else><el-tag size="mini" type="success" effect="dark">线上课</el-tag></span>
                        </span>
                    </template>
                </el-table-column>
                <el-table-column prop="createdDate" label="创建时间"
                                 width="150">
                </el-table-column>
                <el-table-column prop="useCount" label="被使用" width="80">
                </el-table-column>
                <el-table-column label="状态" width="85">
                    <template slot-scope="scope">
                        <span v-if="scope.row.locked"><el-tag size="mini" type="danger" effect="dark">停 用</el-tag></span>
                        <span v-else><el-tag size="mini" type="success" effect="dark">启 用</el-tag></span>
                    </template>
                </el-table-column>
                <el-table-column width="100" align="right">
                    <template slot-scope="scope">
                        <el-dropdown :show-timeout="0" placement="left">
                            <el-button icon="el-icon-arrow-left" size="mini" v-on:click.stop="return false">
                                操作
                            </el-button>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item icon="el-icon-edit" v-on:click.native="btnEditClick(scope.row)">修改</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-document-copy" v-on:click.native="btnCopyClick(scope.row)">复制</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-unlock" v-if="scope.row.locked" v-on:click.native="btnUnLockClick(scope.row.id)">启用</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-lock" v-else v-on:click.native="btnLockClick(scope.row.id)">停用</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-s-data" v-on:click.native="btnCourseManagerAnalysisClick(scope.row)" divided>综合统计</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-user" v-on:click.native="btnManagerUserClick(scope.row)">学习情况</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-s-order" v-on:click.native="btnManagerScoreClick(scope.row)" v-if="scope.row.examId>0">考试成绩</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-document" v-on:click.native="btnManagerQClick(scope.row)" v-if="scope.row.examQuestionnaireId>0">调查结果</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-star-off" v-on:click.native="btnManagerEvaluationClick(scope.row)" v-if="scope.row.studyCourseEvaluationId>0">课程评价</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-delete" style="color:red;" v-on:click.native="btnDeleteClick(scope.row)" divided>删除</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </template>
                </el-table-column>
                @await Html.PartialAsync("_PartialTableEmpty")
            </el-table>
            <div style="text-align: center; margin-top: 10px;">
                <el-pagination v-on:current-change="handleCurrentChange" background
                               :current-page="formInline.pageIndex"
                               :page-size="formInline.pageSize"
                               layout="total, prev, pager, next, jumper"
                               :total="total">
                </el-pagination>
            </div>
        </el-card>
    </el-col>
</el-row>

@section Scripts{
    <script src="/sitefiles/assets/js/admin/study/studyCourse.js" type="text/javascript"></script>
}